import { homeActivityService,homeInfoService } from '@/api/admin/common'

const state = {
    homeActivityData: [],
    homeInfoData: [],
};
const mutations = {

    // 首页活动数据
   homeActivityMutations(state, param) {
        state.homeActivityData = param.data;
        // state.total = param.total;
    },

    // 首页资讯数据
    homeInfoMutations(state, param) {
        state.homeInfoData = param.data;
        // state.total = param.total;
    },
};
const actions = {
    // 首页活动数据
    async homeActivityActions(context) {
        await homeActivityService().then(resp => {
            if (!resp) return;
            console.log("home-->", resp.data);
            context.commit('homeActivityMutations', resp.data)
        }, error => {
            console.log(error);
        })
    },

    // 首页活动数据
    async homeInfoActions(context) {
        await homeInfoService().then(resp => {
            if (!resp) return;
            console.log("home-->", resp.data);
            context.commit('homeInfoMutations', resp.data)
        }, error => {
            console.log(error);
        })
    },
};

export default {
    namespaced: true,
    state,
    mutations,
    actions,
}